<?php
function outputRe($pattern, $string) {
    if (preg_match_all($pattern, $string, $matched)) {
        echo '正则表达式:', htmlentities($pattern), '和字符串：', htmlentities($string), '匹配成功，匹配的字符串是：', "<br />";
        echo '<pre>';
        var_dump($matched);
        echo '</pre>';
    } else {
        echo "<p>", '没找到匹配字符', "</p>";
    }
}

// $pattern = '/php/';
// $pattern = '~php~';
// $pattern = '/./s';
// $pattern = '/[0-9a-zA-Z]/';
// $pattern = '/[\x80-\xff]/';
$pattern = '/\\\\/';
$pattern = '/[\x80-\xff]{6}/';
$pattern = '/[A-Z]+/';
$pattern = '/\d+/';

$string = 'hello,php122345汉··、\《》四个汉字字67890ZdadB----';
outputRe($pattern, $string);
// phpinfo();
?>
